// eslint-disable-next-line
import { UserLayout, BasicLayout, BlankLayout , PageView } from '@/layouts'
import { bxAnaalyse } from '@/core/icons'

const RouteView = {
  name: 'RouteView',
  render: h => h('router-view')
}
export const asyncRouterMap = [
  {
    path: '/',
    name: 'index',
    component: BasicLayout,
    meta: { title: 'menu.home' },
    redirect: '/newMall/goodsWarehouse',
    children: [
      // 会员信息管理
      {
        path: '/member',
        name: 'member',
        redirect: '/member/index',
        component: PageView,
        meta: { title: '会员信息' , keepAlive: false, icon: 'team', permission: ['queryMember','updateShoppingRankRecord']},
        children: [
          {
            path: '/member/register',
            name: 'memRegister',
            component: () => import('@/views/member/register'),
            meta: { title: '快速注册' , keepAlive: false, permission: ['brandRegister']}
          },
          {
            path: '/member/index',
            name: 'memberIndex',
            component: () => import('@/views/member/member'),
            meta: { title: '会员信息管理' , keepAlive: false, permission: ['queryMember','updateUserGrade','queryGradeProduct','queryBrand','setUserIgnorePassword','queryUserFilecoinAddress','queryUserRelation']}
          },
          {
            path: '/member/index/userInfo',
            name: 'memberIndexUserInfo',
            hidden: true,
            component: () => import('@/views/member/member/components/userInfo'),
            meta: { title: '个人信息' , keepAlive: false, permission: ['queryMember']}
          },
          {
            path: '/member/sonVipOrder',
            name: 'memberSonVipOrder',
            hidden: true,
            component: () => import('@/views/member/sonVipOrder'),
            meta: { title: '交易统计' , keepAlive: false, permission: ['querySonVipOrder']}
          },
          {
            path: '/member/userAccount',
            name: 'memberUserAccount',
            component: () => import('@/views/member/userAccount'),
            meta: { title: '用户账户信息' , keepAlive: false, permission: ['queryUserAccount']}
          },
          {
            path: '/power/updateUserRelation',
            name: 'updateUserRelation',
            component: () => import('@/views/power/updateUserRelation'),
            meta: { title: '修改用户上下级' , keepAlive: false, permission: ['updateUserRelation']}
          },
          {
            path: '/member/black/list',
            name: 'memberBlackList',
            component: () => import('@/views/member/black'),
            meta: { title: '黑名单管理' , keepAlive: false, permission: ['queryBlacklist']}
          },
          {
            path: '/member/password',
            name: 'memPassword',
            component: () => import('@/views/member/password'),
            meta: { title: '修改密码' , keepAlive: false, permission: ['updatePassword']}
          },
          {
            path: '/member/updatePhone',
            name: 'updatePhone',
            component: () => import('@/views/member/updatePhone'),
            meta: { title: '更换手机号' , keepAlive: false, permission: ['updateUserPhone']}
          },
          {
            path: '/newMall/goodsOrder/riderOrderHouse',
            name: 'mallGoodsaRiderOrderHouse',
            component: () => import('@/views/newMall/riderGoodsOrder/warehouse'),
            meta: { title: '花店排序' , keepAlive: false, permission: ['updateShoppingRankRecord']}
          },
          {
            path: '/member/shoppingRank',
            name: 'memberShoppingRank',
            hidden: true,
            component: () => import('@/views/member/shoppingRank'),
            meta: { title: '花店排序' , keepAlive: false, permission: ['updateShoppingRankRecord']}
          },
          {
            path: '/newMall/riderRegister',
            name: 'newMallRiderRegister',
            component: () => import('@/views/newMall/riderRegister'),
            meta: { title: '骑手信息注册' , keepAlive: false, permission: ['updateRiderUserInfo']}
          },
         
        ]
      },
      // 商品管理
      {
        path: '/mall/goods',
        name: 'mall',
        redirect: '/mall/goods',
        component: PageView,
        hidden: true,
        meta: { title: '商品管理' , keepAlive: false, icon: 'audit', permission: ['updateClassify']},
        children: [
          {
            path: '/mall/classify',
            name: 'mallClassify',
            component: () => import('@/views/mall/classify'),
            meta: { title: '商品分类' , keepAlive: false, permission: ['queryClassify','updateClassify']}
          },
          {
            path: '/mall/spec',
            name: 'mallSpec',
            component: () => import('@/views/mall/spec'),
            meta: { title: '商品规格' , keepAlive: false, permission: ['querySpecTemplate','updateSpecTemplate']}
          },
          {
            path: '/special/area',
            name: 'specialArea',
            component: () => import('@/views/mall/specialArea'),
            meta: { title: '商品专区' , keepAlive: false, permission: ['querySpecialArea','updateSpecialArea']}
          },
          {
            path: '/mall/make',
            name: 'mallMake',
            component: () => import('@/views/mall/make'),
            meta: { title: '供应商' , keepAlive: false, permission: ['queryMake','updateMake']}
          },
          {
            path: '/mall/goods',
            name: 'mallGoods',
            component: () => import('@/views/mall/goods'),
            meta: { title: '商品列表' , keepAlive: false, permission: ['queryGoodsInfo','updateGoodsInfo']}
          },
          {
            path: '/mall/goods/detail',
            name: 'mallGoodsDetail',
             hidden: true,
            component: () => import('@/views/mall/goods/detail'),
            meta: { title: '商品详情' , keepAlive: true, permission: ['queryGoodsInfo','updateGoodsInfo','querySpecTemplate']}
          },
        ]
      },
      {
        path: '/newMall',
        name: 'newMall',
        redirect: '/newMall/goods',
        component: BlankLayout,
        meta: { title: '商品管理' , keepAlive: false, icon: 'shopping', permission: ['updateClassify','updateGoodsCommonConfig','updateGoodsDetail','updateGoodsGeneral','updateRiderUserInfo','upadteGoodsLists','queryGoodsStorehouseBindConfigByUserid','queryGoodsPurchaseForm']},
        children: [
          {
            path: '/newMall/classify',
            name: 'newMallClassify',
            hidden: true,
            component: () => import('@/views/newMall/classify'),
            meta: { title: '商品分类' , keepAlive: false, permission: ['queryClassify','updateClassify']}
          },
          {
            path: '/newMall/specification',
            name: 'newMallSpecification',
            component: () => import('@/views/newMall/specification'),
            meta: { title: '商品公共信息配置' , keepAlive: false, permission: ['updateGoodsCommonConfig']}
          },
          {
            path: '/newMall/warehouse',
            name: 'newMallWarehouse',
            component: () => import('@/views/newMall/warehouse'),
            meta: { title: '商品仓库客服绑定' , keepAlive: false, permission: ['updateGoodsStorehouseBindConfig']}
          },
          {
            path: '/newMall/zone',
            name: 'newMallZone',
            hidden: true,
            component: () => import('@/views/newMall/specification/zone'),
            meta: { title: '商品分区' , keepAlive: false, permission: ['updateGoodsArea']}
          },
          {
            path: '/newMall/goodDetail',
            name: 'newMallGoodDetail',
            hidden: true,
            component: () => import('@/views/newMall/goods/goodsDetail'),
            meta: { title: '商品配置' , keepAlive: false, permission: ['updateGoodsDetail']}
          },
          {
            path: '/newMall/goods',
            name: 'newMallGoods',
            hidden: true,
            component: () => import('@/views/newMall/goods/goodsGeneral'),
            meta: { title: '商品配置' , keepAlive: false, permission: ['updateGoodsGeneral']}
          },
          {
            path: '/newMall/goodsClassify',
            name: 'newMallGoodsClassify',
            component: () => import('@/views/newMall/goods'),
            meta: { title: '商品配置' , keepAlive: false, permission: ['updateGoodsGeneral']}
          },
          {
            path: '/newMall/goodLists',
            name: 'newMallGoodLists',
            hidden: true,
            component: () => import('@/views/newMall/goods/goodLists'),
            meta: { title: '商品上架' , keepAlive: false, permission: ['upadteGoodsLists']}
          },
          {
            path: '/newMall/goodsWarehouse',
            name: 'newMallGoodsWarehouse',
            component: () => import('@/views/newMall/goods/goodsWarehouse'),
            meta: { title: '仓库上架' , keepAlive: false, permission: ['queryGoodsStorehouseBindConfigByUserid']}
          },
          {
            path: '/newMall/purchaseOrder',
            name: 'newMallPurchaseOrder',
            hidden: true,
            component: () => import('@/views/newMall/goods/purchaseOrder'),
            meta: { title: '上单表' , keepAlive: false, permission: ['queryGoodsPurchaseForm']}
          },
          {
            path: '/newMall/purchaseOrderStatisDate',
            name: 'newMallPurchaseOrderStatisDate',
            hidden: true,
            component: () => import('@/views/newMall/goods/purchaseOrder/statisDate'),
            meta: { title: '上下单表统计日' , keepAlive: false, permission: ['queryGoodsPurchaseFormStatisticalDate']}
          },
          {
            path: '/newMall/purchase',
            name: 'newMallPurchase',
            hidden: true,
            component: () => import('@/views/newMall/goods/purchase'),
            meta: { title: '下单表' , keepAlive: false, permission: ['queryGoodsPurchaseForm']}
          },
          {
            path: '/newMall/goodsStock',
            name: 'newMallGoodsStock',
            hidden: true,
            component: () => import('@/views/newMall/goodsStock'),
            meta: { title: '库存盘点' , keepAlive: false, permission: ['updateGoodsStockVerification']}
          },
          {
            path: '/newMall/goodsStockAll',
            name: 'newMallGoodsStockAll',
            component: () => import('@/views/newMall/goodsStock'),
            meta: { title: '库存盘点' , keepAlive: false, permission: ['updateGoodsStockVerification']}
          },
          {
            path: '/newMall/merchant',
            name: 'newMallMerchant',
            component: () => import('@/views/newMall/merchant'),
            meta: { title: '商城商家入驻' , keepAlive: false, permission: ['updateGoodsMerchantInfo']}
          },
        ]
      },
      {  //商城订单管理
        path: '/mall/goodsOrder',
        name: 'mallOrder',
        // hidden: true,
        redirect: '/mall/goodsOrder/order',
        component: PageView,
        meta: { title: '商城订单管理' , keepAlive: false, icon: 'schedule', permission: ['queryGoodsOrder','updateGoodsEvaluationConfig','updateGoodsPurchaseRecord','queryGoodsRiderAllOrder','checkGoodsOrderDeliveryUrgent']},
        children: [
          {
            path: '/mall/goodsOrder/order',
            name: 'mallGoodsOrder',
            component: () => import('@/views/mall/order'),
            meta: { title: '订单列表' , keepAlive: false, permission: ['queryGoodsOrder']}
          },
          {
            path: '/newMall/goodsOrder/urgentOrder',
            name: 'mallGoodsUrgentOrder',
            component: () => import('@/views/newMall/urgentOrder'),
            meta: { title: '商品加急订单' , keepAlive: false, permission: ['checkGoodsOrderDeliveryUrgent']}
          },
          {
            path: '/newMall/goodsOrder/riderOrder',
            name: 'mallGoodsaRiderOrder',
            hidden: true,
            component: () => import('@/views/newMall/riderGoodsOrder'),
            meta: { title: '商品骑手订单分配' , keepAlive: false, permission: ['queryGoodsRiderAllOrder']}
          },
          // {
          //   path: '/mall/goodsOrder/aftersale',
          //   name: 'mallGoodsaftersale',
          //   component: () => import('@/views/mall/aftersale'),
          //   meta: { title: '售后订单' , keepAlive: false, permission: ['queryGoodsAftersale']}
          // },
          {
            path: '/newMall/goodsOrder/riderOrderSon',
            name: 'mallGoodsaRiderOrderSon',
            component: () => import('@/views/newMall/riderGoodsOrderSon'),
            meta: { title: '商品骑手订单排序' , keepAlive: false, permission: ['queryGoodsRiderAllOrder']}
          },
          {
            path: '/newMall/goodsRecord',
            name: 'newMallGoodsRecord',
            component: () => import('@/views/newMall/goodsRecord'),
            meta: { title: '商品购买记录' , keepAlive: false, permission: ['updateGoodsPurchaseRecord']}
          },
          {
            path: '/newMall/goodsEvaluation',
            name: 'newMallGoodsEvaluation',
            component: () => import('@/views/newMall/evaluation'),
            meta: { title: '商品评论配置' , keepAlive: false, permission: ['updateGoodsEvaluationConfig']}
          },
        ]
      },
      //商城配送管理
      {  
        path: '/mall/distribution',
        name: 'mallDistribution',
        // hidden: true,
        redirect: '/mall/distribution/deliveryTime',
        component: PageView,
        meta: { title: '商城配送管理' , keepAlive: false, icon: 'reconciliation', permission: ['updateGoodsTimeConfig','updateGoodsCityConfig','updateGoodsFreightConfig','updateGoodsUrgentConfig']},
        children: [
          {
            path: '/mall/distribution/deliveryTime',
            name: 'mallDistributionDeliveryTime',
            component: () => import('@/views/brandManage/deliveryTime'),
            meta: { title: '送达时间设置' , keepAlive: false, permission: ['updateGoodsTimeConfig']}
          },
          {
            path: '/mall/distribution/cityConfig',
            name: 'mallDistributionCityConfig',
            hidden: true,
            component: () => import('@/views/newMall/cityConfig'),
            meta: { title: '配送城市配置' , keepAlive: false, permission: ['updateGoodsCityConfig']}
          },
          {
            path: '/mall/distribution/freightConfig',
            name: 'mallDistributionFreightConfig',
            component: () => import('@/views/newMall/freightConfig'),
            meta: { title: '商品运费配置' , keepAlive: false, permission: ['updateGoodsFreightConfig']}
          },
          {
            path: '/mall/distribution/urgentConfig',
            name: 'mallDistributionUrgentConfig',
            component: () => import('@/views/newMall/urgentConfig'),
            meta: { title: '商品加急配置' , keepAlive: false, permission: ['updateGoodsUrgentConfig']}
          },
        ]
      },
      // 交易查询
      {
        path: '/order',
        name: 'order',
        redirect: '/order/statistical',
        component: PageView,
        meta: { title: '交易记录' , keepAlive: false, icon: 'transaction', permission: ['queryTransactionType','queryTransactionOrder','queryAwardRecord','queryOrderFormDailyStat']},
        children: [
          {
            path: '/order/dailyStat',
            name: 'orderDailyStat',
            component: () => import('@/views/order/dailyStat'),
            meta: { title: '数据统计' , keepAlive: false, permission: ['queryOrderFormDailyStat']}
          },
          {
            path: '/order/transaction',
            name: 'transaction',
            component: () => import('@/views/order/transaction'),
            meta: { title: '交易明细' , keepAlive: false, permission: ['queryTransactionType','queryTransactionOrder']}
          },
          // {
          //   path: '/order/channelStat',
          //   name: 'orderChannelStat',
          //   component: () => import('@/views/order/channelStat'),
          //   meta: { title: '数据汇总' , keepAlive: false, permission: ['queryOrderFormDailyStat']}
          // },
          {
            path: '/order/awardRecord',
            name: 'awardRecord',
            component: () => import('@/views/order/awardRecord'),
            meta: { title: '返佣明细' , keepAlive: false, permission: ['queryAwardRecord']}
          },
        ]
      },
      {
        path: '/promotion',
        name: 'promotion',
        redirect: '/product/grade',
        component: PageView,
        meta: { title: '推广模式管理' , keepAlive: false, icon: 'deployment-unit', permission: ['updateGradeProduct','updateGradeUp','updateDiffAwardConfig','updateTopUpConfig','queryGoddsCouponInfo','updateGoodsCouponConfig']},
        children: [
          {
            path: '/product/grade',
            name: 'grade',
            component: () => import('@/views/product/product'),
            meta: { title: '用户等级管理' , keepAlive: false, permission: ['updateGradeProduct']}
          },
          {
            path: '/product/upGradeConfig',
            name: 'upGradeConfig',
            component: () => import('@/views/product/upGradeConfig'),
            meta: { title: '等级升级配置' , keepAlive: false, permission: ['updateGradeUp']}
          },
          {
            path: '/product/gradeAward',
            name: 'gradeAward',
            component: () => import('@/views/product/gradeAward'),
            meta: { title: '等级返佣奖励配置' , keepAlive: false, permission: ['updateDiffAwardConfig']}
          },
          {
            path: '/product/topUpConfig',
            name: 'topUpConfig',
            component: () => import('@/views/product/topUpConfig'),
            meta: { title: '充值配置' , keepAlive: false, permission: ['updateTopUpConfig']}
          },
          {
            path: '/product/couponModel',
            name: 'couponModel',
            component: () => import('@/views/product/couponModel/layout'),
            meta: { title: '优惠券配置信息' , keepAlive: false, permission: ['queryGoddsCouponInfo','updateGoodsCouponConfig']},
            redirect: '/product/awardModel/awards',
            children: [
              {
                path: '/product/couponModel/awards',
                name: 'couponModelAwards',
                component: () => import('@/views/product/couponModel/awards'),
                meta: { title: '优惠券信息' , keepAlive: false, permission: ['queryGoddsCouponInfo']}
              },
              {
                path: '/product/couponModel/config',
                name: 'couponModelConfig',
                component: () => import('@/views/product/couponModel/config'),
                meta: { title: '优惠券奖励配置' , keepAlive: false, permission: ['updateGoodsCouponConfig']}
              },
            ]
          },
          // {
          //   path: '/product/equalGradeRewards',
          //   name: 'equalGradeRewards',
          //   component: () => import('@/views/product/equalGradeRewards'),
          //   meta: { title: '平级奖励配置' , keepAlive: false, permission: ['updateEqualGradeRewardsConfig']}
          // },
          // {
          //   path: '/product/teamRebateAward',
          //   name: 'teamRebateAward',
          //   component: () => import('@/views/product/teamRebateAward'),
          //   meta: { title: '团队奖励配置' , keepAlive: false, permission: ['updateTeamRebateAwardConfig']}
          // },
        ]
      },
      {
        path: '/brandManage',
        name: 'brandManage',
        redirect: '/brandManage/channelConfig',
        component: PageView,
        meta: { title: '运营管理' , keepAlive: false, icon: 'project', permission: ['updateBanner','updateBrandConfig','updateBrandChannelConfig','queryBrandAliWAPPayAccount','queryGoodsTimeConfig','updateGoodsTimeConfig','updateSuggestionsTagInfo','updateGoddsOrderAmountConfig']},
        children: [
          {
            path: '/brandManage/brandConfig',
            name: 'brandConfig',
            component: () => import('@/views/brandManage/brandConfig/newConfig'),
            meta: { title: '品牌配置' , keepAlive: false, permission: ['updateBrandConfig']}
          },
          {
            path: '/brandManage/channelConfig',
            name: 'channelConfig',
            component: () => import('@/views/brandManage/channelConfig'),
            meta: { title: '通道配置' , keepAlive: false, permission: ['queryBrandChannelConfig','updateBrandChannelConfig','updateAllChannelConfig']}
          },
          // {
          //   path: '/brandManage/aliWapPayAccount',
          //   name: 'aliWapPayAccount',
          //   component: () => import('@/views/brandManage/aliWapPayAccount'),
          //   meta: { title: '支付宝WAP支付账户' , keepAlive: false, permission: ['updateBrandAliWAPPayAccount']}
          // },
          {
            path: '/brandManage/bulletin',
            name: 'bulletin',
            component: () => import('@/views/brandManage/news/bulletin'),
            meta: { title: '首页公告信息' , keepAlive: false, permission: ['queryBanner','updateBanner',]}
          },
          {
            path: '/brandManage/news',
            name: 'news',
            component: () => import('@/views/brandManage/news/layout'),
            meta: { title: '活动新闻管理' , keepAlive: false, permission: ['queryBanner','updateBanner','queryNewsClassification']},
            redirect: '/brandManage/news/news',
            children: [
              {
                path: '/brandManage/news/news',
                name: 'brandManageNews',
                component: () => import('@/views/brandManage/news/news'),
                meta: { title: '活动新闻信息' , keepAlive: false, permission: ['queryBanner','updateBanner']}
              },
              {
                path: '/brandManage/news/classification',
                name: 'brandManageNewsClassification',
                component: () => import('@/views/brandManage/news/classification'),
                meta: { title: '活动分类配置' , keepAlive: false, permission: ['updateNewsClassification','queryNewsClassification']}
              },
            ]
          },
          {
            path: '/brandManage/feedbackConfig',
            name: 'feedbackConfig',
            component: () => import('@/views/brandManage/feedbackConfig'),
            meta: { title: '工单问题信息' , keepAlive: false, permission: ['updateSuggestionsTagInfo',]}
          },
          {
            path: '/brandManage/closeConfig',
            name: 'closeConfig',
            component: () => import('@/views/brandManage/closeConfig'),
            meta: { title: '打烊时间配置' , keepAlive: false, permission: ['updateGoodsCloseConfig',]}
          },
          {
            path: '/brandManage/goodsOrderPrint',
            name: 'goodsOrderPrint',
            component: () => import('@/views/brandManage/goodsOrderPrint'),
            meta: { title: '商品订单自动打印配置' , keepAlive: false, permission: ['updateGoodsOrderPrintConfig',]}
          },
          {
            path: '/brandManage/goodsOrderAmountConfig',
            name: 'goodsOrderAmountConfig',
            component: () => import('@/views/brandManage/goodsOrderAmountConfig'),
            meta: { title: '商品下单金额配置' , keepAlive: false, permission: ['updateGoddsOrderAmountConfig',]}
          },
        ]
      },
      // 权限管理
      {
        path: '/power',
        name: 'power',
        redirect: '/power/developmentLogin',
        component: PageView,
        meta: { title: '权限管理' , keepAlive: false, icon: 'lock', permission: ['updateRoleUser','setUserIgnorePassword','uploadBrandFile','updateRoleUser','updateRoleResource','updateRoleName','updateResourceGroup','updateResource']},
        children: [
          {
            path: '/power/developmentLogin',
            name: 'developmentLogin',
            component: () => import('@/views/power/developmentLogin'),
            meta: { title: '测试人员登录账号' , keepAlive: false, permission: ['setUserIgnorePassword']}
          },
          {
            path: '/power/uploadOss',
            name: 'uploadOss',
            component: () => import('@/views/power/uploadOss'),
            meta: { title: '文件生成链接' , keepAlive: false, permission: ['uploadBrandFile']}
          },
          {
            path: '/power/roles',
            name: 'roles',
            component: () => import('@/views/power/roles/layout'),
            meta: { title: '角色权限配置' , keepAlive: false, permission: ['updateRoleUser','updateRoleResource','updateRoleName','updateResourceGroup','updateResource']},
            redirect: '/power/roles/resourceGroup',
            children: [
              {
                path: '/power/roles/userRole',
                name: 'userRole',
                component: () => import('@/views/power/roles/userRole'),
                meta: { title: '已配置角色用户' , keepAlive: false, permission: ['updateRoleUser']}
              },
              {
                path: '/power/roles/roleResource',
                name: 'roleResource',
                component: () => import('@/views/power/roles/roleResource'),
                meta: { title: '角色资源配置' , keepAlive: false, permission: ['updateRoleResource']}
              },
              {
                path: '/power/roles/role',
                name: 'role',
                component: () => import('@/views/power/roles/role'),
                meta: { title: '角色配置' , keepAlive: false, permission: ['updateRoleName']}
              },
              {
                path: '/power/roles/resourceGroup',
                name: 'resourceGroup',
                component: () => import('@/views/power/roles/resourceGroup'),
                meta: { title: '资源组配置' , keepAlive: false, permission: ['updateResourceGroup']}
              },
              {
                path: '/power/roles/resource',
                name: 'resource',
                component: () => import('@/views/power/roles/resource'),
                meta: { title: '资源配置' , keepAlive: false, permission: ['updateResource']}
              },
            ]
          },
        ]
      },
    ]
  },
  {
    path: '*',
    redirect: '/404',
    hidden: true
  }
]

/**
 * 基础路由
 * @type { *[] }
 */
export const constantRouterMap = [
  {
    path: '/user',
    component: UserLayout,
    redirect: '/user/login',
    hidden: true,
    children: [
      {
        path: 'login',
        name: 'login',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/Login')
      },
      {
        path: 'riderLogin',
        name: 'riderLogin',
        component: () => import(/* webpackChunkName: "user" */ '@/views/user/LoginRiders')
      },
      // {
      //   path: 'register',
      //   name: 'register',
      //   component: () => import(/* webpackChunkName: "user" */ '@/views/user/Register')
      // },
      // {
      //   path: 'recover',
      //   name: 'recover',
      //   component: undefined
      // }
    ]
  },

  {
    path: '/404',
    component: () => import(/* webpackChunkName: "fail" */ '@/views/exception/404')
  }
]
